/**
 * Copyright (C) 2014 Domon.Xie All Rights Reserved.
 *
 * PropertyConfigureReader.java
 * 2014年10月21日 下午8:53:30
 */
package org.domon.spring.beans.config;

import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Properties;

import org.springframework.beans.BeansException;
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer;

/**
 * 增加
 * @author Domon.Xie
 * 
 */
public class PropertyPlaceOwnerConfigurer extends PropertyPlaceholderConfigurer {

    private final static Map<String, Object> ctxPropertiesMap = new HashMap<String, Object>();

    @Override
    protected void processProperties(ConfigurableListableBeanFactory beanFactoryToProcess, Properties props) throws BeansException {
        super.processProperties(beanFactoryToProcess, props);

        for (Entry<Object, Object> entry : props.entrySet()) {
            ctxPropertiesMap.put(entry.getKey().toString(), entry.getValue());
        }
    }
    
    public static Object getContextProperty(String name) {
        return ctxPropertiesMap.get(name);
    }
}
